//
//  HSYAnimationHelper.h
//  高仿暴走斗图
//
//  Created by huangsongyao on 16/3/4.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import <Foundation/Foundation.h>


typedef NS_ENUM(NSUInteger, kSystemAnimationType) {
    
    kSystemAnimationTypeNone,                           //无
    kSystemAnimationTypePageCurl,                       //上翻页
    kSystemAnimationTypePageUnCurl,                     //下翻页
    kSystemAnimationTypeRippleEffect,                   //水波扩散
    kSystemAnimationTypeSuckEffect,                     //吸收
    kSystemAnimationTypeCube,                           //魔方
    kSystemAnimationTypeOglFlip,                        //翻转
    kSystemAnimationTypeCameraIrisHollowOpen,           //打开相机
    kSystemAnimationTypeCameraIrisHollowClose,          //关闭相机
    kSystemAnimationTypeFade,                           //渐入渐出
    kSystemAnimationTypeMoveIn,                         //卡片移动
    kSystemAnimationTypePush,                           //push推动
    kSystemAnimationTypeReveal,                         //卡片抽离
    kSystemAnimationTypeOpen,                           //渐变
    
    //protect API，目前苹果已经禁用，使用的话效果全部为“淡出效果”
    kSystemAnimationTypeUnGenieEffect,                  
    kSystemAnimationTypeSpewEffect,                     
    kSystemAnimationTypeGenieEffect,                    
    kSystemAnimationTypeTwist,                          
    kSystemAnimationTypeTubey,                          
    kSystemAnimationTypeSwirl,                          
    kSystemAnimationTypeCharminUltra,                   
    kSystemAnimationTypeZoomyIn,                        
    kSystemAnimationTypeZoomyOut,                       
    kSystemAnimationTypeOglApplicationSuspend,
    
};

@interface HSYAnimationHelper : NSObject

+ (instancetype)shareInstance;

/**
 *  添加系统动画
 *
 *  @param animation   动画类型，枚举
 *  @param layer       添加的层
 *  @param duration    动画时间
 *  @param subtype     放向
 *  @param key         key
 *  @param compaletion 完成后执行的block
 */
- (void)customSystemAnimationWithType:(kSystemAnimationType)animation withLayer:(CALayer *)layer duration:(CGFloat)duration subtype:(NSString *)subtype key:(NSString *)key compaletion:(void(^)())compaletion;

/**
 *  定制POP库动画，放缩动画
 *
 *  @param layer            添加的层
 *  @param fromValue        动画执行值，from
 *  @param toValue          动画执行的值，to，例如弹性放缩：[NSValue valueWithCGSize:CGSizeMake(300, 300)]
 *  @param propertyName     动画类型
 *  @param springBounciness 弹性值
 *  @param springSpeed      弹性速度
 */
- (void)customPOPAnimationForLayer:(CALayer *)layer withPropertyName:(NSString *)propertyName toValue:(NSValue *)toValue fromValue:(NSValue *)fromValue springBounciness:(CGFloat)springBounciness springSpeed:(CGFloat)springSpeed;

/**
 *  放缩动画
 *
 *  @param layer            添加的层
 *  @param toValue          放缩值,to
 *  @param fromValue        放缩值,from
 *  @param springBounciness 弹性值
 *  @param springSpeed      弹性速度
 */
- (void)customPOPZoomInAnimationForLayer:(CALayer *)layer toValue:(NSValue *)toValue fromValue:(NSValue *)fromValue springBounciness:(CGFloat)springBounciness springSpeed:(CGFloat)springSpeed;

/**
 *  缩放框动画
 *
 *  @param layer            添加的层
 *  @param toValue          放缩值,to
 *  @param fromValue        放缩值,from
 *  @param springBounciness 弹性值
 *  @param springSpeed      弹性速度
 */
- (void)customPOPEjectAnimationForLayer:(CALayer *)layer toValue:(NSValue *)toValue fromValue:(NSValue *)fromValue springBounciness:(CGFloat)springBounciness springSpeed:(CGFloat)springSpeed;

/**
 *  淡入淡出动画
 *
 *  @param view  添加的层
 *  @param value alpha值, 范围是[0,1]
 *  @param key   key
 */
- (void)customPOPFadeInAnimationInView:(UIView *)view toValue:(NSNumber *)value forKey:(NSString *)key;


- (void)customPOPZPositionAnimationForLayer:(CALayer *)layer toValue:(NSValue *)toValue fromValue:(NSValue *)fromValue springBounciness:(CGFloat)springBounciness springSpeed:(CGFloat)springSpeed;
@end
